<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./js/vue.js"></script>
    <style>
        .active{
            color: red;
        }
    </style>
</head>
<body>
    <div id="app">
        <ul>
            <li :class="{active:currentIndex === index}" v-for="(item,index) in movies" @click="liClick(index)">{{item}}</li>
        </ul>
    </div>
    <script>
        new Vue({
            el:'#app',
            data:{
                movies:["星际穿越","飞驰人生","喜羊羊"],
                currentIndex:''
            },
            methods: {
                liClick(index){
                    this.currentIndex=index
                }
            }
        })
    </script>
</body>
</html>